public class Date {
    public int year;
    public int month;
    public int day;


    //形参名与变量名相同，会使计算机识别不出来打印哪个对象
//    public void setDay(int year, int month, int day){
//        year = year;
//        month = month;
//        day = day;
//    }

    //解决方法：使用this关键字
    public void setDay(int year,int month,int day){
        this.year = year;
        this.month = month;
        this.day = day;
    }

    public void setDay2(int y, int m, int d){
        year = y;
        month = m;
        day = d;
    }

    public void printDate(){
        System.out.println(year+"/"+month+"/"+day);
    }


}
